import http from '@/utils/http'

const baseURL  = '/index'

/**
 * 获取用户地址
 */
export function fetchAddressListApi() {
  return http.get(baseURL + '/fetchAddressList', {}, { custom: { loading: true } });
}

/**
 * 设置默认地址
 */
export function setDefaultAddressApi(id) {
  return http.post(baseURL + '/setDefaultAddress', { id }, { custom: { loading: true } });
}

/**
 * 删除地址
 */
export function deleteAddressAPI(id) {
  return http.post(baseURL + '/deleteAddress', { id }, { custom: { loading: true } });
}

/**
 * 获取地址信息
 */
export function getAddressInfoAPI(id) {
  return http.get(baseURL + '/getAddressInfo', {id}, { custom: { loading: true } });
}

/**
 * 修改地址
 */
export function editAddressAPI(data) {
  return http.post(baseURL + '/editAddress', data, { custom: { loading: true } });
}